package vip.specimen.system.datasource.validation;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Range;
import vip.specimen.system.datasource.validation.annotation.AdminDrop;
import vip.specimen.system.datasource.validation.annotation.EmailUnique;
import vip.specimen.system.datasource.validation.annotation.PhoneUnique;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Set;
import java.util.UUID;

/**
 * *@Author: 余浪人
 * *@Date：2021/3/23 14:33
 * *@Email:yulangren520@Gmail.com
 * *@QQ:1368419640
 **/
@Getter
@Setter
public class SystemUserValidation {
    @Size(max = 128, message = "昵称过长")
    private String name;
    @EmailUnique
    @Email(message = "请输入合法的email")
    @Size(max = 64, message = "邮箱地址过长")
    private String email;
    @PhoneUnique
    @Size(max = 11, message = "电话号码超出11位")
    @Pattern(regexp = "^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$", message = "输入的电话号码不合法")
    private String phone;
    @Range(min = 1, max = 120, message = "年龄输入不合法")
    private int age;
    @NotNull(message = "请选择性别")
    @Range(min = 0, max = 2, message = "请输入合法的性别")
    private Integer gender;
    @NotNull(message = "请选择角色")
    private Set<UUID> systemRole;
    @Size(max = 255, message = "头像地址过长")
    private String portrait;
    @AdminDrop
    private boolean admin;
}
